Pop
Purpose
The pop task removes the last item from a non-empty job array variable and returns the removed item with a success finish state. It returns a failure finish state if the the job array variable has no elements.
Properties
Incoming | Description |
---|---|
Select Job Variable (required) | Select the job variable that will be modified. |
Outgoing | Description |
---|---|
popped_item |
The outgoing variable which contains the removed item. |
Example
Assume a job variable named fruits
with value ["apple","banana","orange"]
and you want to remove the last element.
- In the pop task's properties dialog box, select
fruits
from the Select Job Variables dropdown. - Click UPDATE.
The pop task changes job variable fruits
to have value ["apple","banana"]
, and it returns value orange
in its outgoing variable popped_item
.
Figure: Pop task
Push
Purpose
The push task adds an item to the end of a job array variable.
Properties
Property | Description |
---|---|
Select Job Variable (required) | Select the job variable from the dropdown list that will receive a new item at the end of its array value. |
Item Location (required) | Specify where to find the item to add. The item location may come from a "job" variable, a "static" value, or an earlier task's outgoing variable. |
Item (required) | If Item location is "static", the Value field becomes a text edit box; type the new value. If Item location is "job" or an earlier task, the Value field becomes a dropdown list; select one of the listed variables. |
Example
Assume a job variable named fruits
with value ["apple","banana","orange"]
and you want to add pear
as a fourth element in the array.
- In the push task properties dialog box, select
fruits
from the Select Job Variables dropdown. - Select Item Location
static
. - Type
pear
in the Item text box. - Click UPDATE.
The push task changes job variable fruits to have value ["apple","banana","orange", "pear"]
.
Figure: Push task
Shift
Purpose
The shift task removes the first item from a non-empty job array variable and returns the removed item with a success finish state. It returns a failure finish state if the the job array variable has no elements.
Properties
Incoming | Description |
---|---|
Select Job Variable (required) | Select the job variable that will be modified. |
Outgoing | Description |
---|---|
shifted_item |
The outgoing variable which contains the removed item. |
Example
Assume a job variable named fruits
with value ["apple","banana","orange"]
and you want to remove the first element.
- In the pop task's properties dialog box, select
fruits
from the Select Job Variables dropdown. - Click UPDATE.
The shift task changes job variable fruits
to have value ["banana","orange"]
, and it returns value apple
in its outgoing variable shifted item
.
Figure: Shift task